package com.lanou.sinasports.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.lanou.sinasports.fragment.MatchHotFragment;
import com.lanou.sinasports.fragment.NBAFragment;
import com.lanou.sinasports.fragment.NewsHotFragment;
import com.lanou.sinasports.fragment.NewsRecommandFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by dllo on 16/1/10.
 */
public class NewsAdapter extends FragmentPagerAdapter {
    private List<Fragment> fragments;
    private String[] titles={"热门","推荐","NBA"};

    public NewsAdapter(FragmentManager fm) {
        super(fm);
        fragments=new ArrayList<>();
        NBAFragment nbaFragment=new NBAFragment();
        NewsHotFragment newsHotFragment=new NewsHotFragment();
        NewsRecommandFragment newsRecommandFragment=new NewsRecommandFragment();

        fragments.add(newsHotFragment);
        fragments.add(newsRecommandFragment);
        fragments.add(nbaFragment);

    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
